<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="favicon.ico">
    <link href="__PUBLIC__/chat/css/reset.min.css" rel="stylesheet">
    <link href="__PUBLIC__/chat/css/style.css" rel="stylesheet">
</head>

<body>
    <div class="wrapper">
        <div class="container">
            <div class="left">
                <div style="margin-top:50px;"></div>
                <ul class="people">

                    {volist name="member" id="vo"}
                    <li class="person" data-chat="person{$vo.id}" data-id="{$vo.id}" data-token="{$vo.token}" data-cid="{$cid}">
                        <img src="{$vo.headimgurl}" alt="" />
                        <span class="name">{$vo.user_name}</span>
                        <!--<span class="time">2:09 PM</span>-->
                        <span class="preview">{$vo.summary}</span>
                    </li>
                    {/volist}



                </ul>
            </div>
            <div class="right">
                <div class="top"><span>To: <span class="name">Dog Woofson</span></span></div>

                {volist name="member" id="vo"}
                <div class="chat chat{$vo.id}" data-chat="person{$vo.id}">

                </div>
                {/volist}



            </div>
        </div>
    </div>
</body>
<!-- 全局js -->
<script src="__PUBLIC__/admin/js/jquery.min.js?v=2.1.4"></script>
<script src="__PUBLIC__/chat/js/index.js"></script>
<script>
    $(document).ready(function() {
        $('.person').on('click', function() {
            var token = $(this).attr('data-token');
            var cid = $(this).attr('data-cid');
            var dataid = $(this).attr('data-id');
            var url="{:url('getmessage')}";
            $.ajax({
                type: "POST",
                url: url,
                data: {token:token,cid:cid},
                success: function(msg){
                    console.log(msg);

                    if(msg.status == 1){
                        var classname = "chat"+dataid;
                        $("."+classname).html(msg.data);
                    }
                }
            });
        })
    })
</script>
</html>
